﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.OldSamllPicPrint.Presenter;
using MINERP.BLL.SmallPic;
using MINERP.MODEL.FoundationModel;
using MINERP.BLL.OldSmallPic;

namespace MINERP.OldSamllPicPrint.Forms
{
    public partial class FrmSelSavePicDir : Form
    {
        OldSamllPicMainBLL _bll;
        /// <summary>
        /// 选择的路径
        /// </summary>
        public string SelectedDirFolder { get; set; }

        public FrmSelSavePicDir()
        {
            InitializeComponent();
            _bll = new OldSamllPicMainBLL();
        }



        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmSelSavePicDir_Load(object sender, EventArgs e)
        {
            //chkIsAutoPrintTicket.Checked = bll.GetPrinterConfigInfo(PrinterId).IsAutoPrintTikect;
           //SelectedDirFolder= _bll.GetReportDir();
           //DataTransfer.StrReportDir = SelectedDirFolder;
           txtPath.Text = SelectedDirFolder;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(SelectedDirFolder))
            {
                MessageBox.Show("请先选择需要导出的文件夹，再进行设定");
                return;
            }

            bool ret = _bll.SetExportDir(SelectedDirFolder);
            if (ret)
            {
                MessageBox.Show("设置成功!");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("连接数据库失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void btnSet_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK == folderBrowserDialog1.ShowDialog())
            {
                SelectedDirFolder = folderBrowserDialog1.SelectedPath;
                txtPath.Text = SelectedDirFolder;

            }
        }

    }
}
